import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold(
      appBar: AppBar(
        title: const Text("Stack Positioned Widget Demo"),
      ),
      body: const StackAndPositioned(),
    ),
  ));
}

class StackAndPositioned extends StatelessWidget {
  const StackAndPositioned({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ConstrainedBox(
      constraints: const BoxConstraints.expand(),
      child: Stack(
        alignment: Alignment.center,
        children: <Widget>[
          Container(
            color: Colors.red,
            child: const Text("Hello World", style: TextStyle(color: Colors.white),)
          ),
          const Positioned(
            left: 18.0,
            child: Text("I am Jack"),
          ),
          const Positioned(
            top:18.0,
            child: Text("Your friend"),
          ),
        ],
      ),
    );
  }
}
